<?php
        /* 发表心得体会页面  2020.6.1
         * 
         *  */
        require_once '../inc/section.php';
        require_once '../inc/book.php';
        require_once '../inc/review.php';
        
?>
<html>
	<head>
		<title>发表你的阅读心得体会-阅读记</title>
		<meta charset="UTF-8">
		
		<link rel="stylesheet" href="../css/postExperience.css">
		<link rel="stylesheet" href="../css/jquery-labelauty.css">
		<script type="text/javascript" src="../inc/jquery-2.1.1.min.js"></script>
		<script src="../script/jquery-labelauty.js"></script>
				
		<script>
		
</script>

	</head>
	
	<body>
	<form name="postForm" id="postForm" onsubmit="return checkFrom()" action="../admin/doPost.php" method="post" id="">
	<?php 

	             
	       $bookId=empty($_GET["bookId"])?"":$_GET["bookId"];
	       $reviewId=empty($_GET["reviewId"])?"":$_GET["reviewId"];	       
	       $current_user=$_SESSION["CURRENT_USER"];
	       $uId=$current_user["uId"];	       
	      /*  $currentPage=empty($_GET["currentPage"])?0:$_GET["currentPage"];//有值  */
	       $book=findbookId($bookId);
	       $sectionId=$book["sectionId"];
	       $section=getSectionId($sectionId);
	       $bookName=$book["bookName"];
	       $sectionName=$section["sectionName"];
	   ?>
	
		<div class="header">
			<div class="headerMain">
				<img src="../image/logo.png" />
				<div class="headerRight">
				<?php 
				    $show="";
				if ($reviewId!="")
				{
				    $show.=<<<html
                        <span>正在修改你的分享...</span>
html;
				
				}
				else 
				{
				    $show.=<<<html
                    <span>发表你的阅读体会</span>
html;
				}
				    echo $show;
				?>
					
					<div class="postExper">
						<button type="submit" id="postSub" name="postSub" onclick="return checkFrom()" >提交</button>
					</div>
					<div class="postPreview">
						<button id="previewBt">预览</button>
					</div>
				</div><!--/headerRight  -->
			</div><!-- headerMain -->
		</div><!-- /header -->
		
		<div class="main" id="main">
			
			<input type="hidden" name="sectionId" value="<?php echo $sectionId; ?>">
			<input type="hidden" name="bookId" value="<?php echo $bookId; ?>">
			<!--  <input type="hidden" name="uId" value="<?php echo $uId; ?>">-->
				<div class="mainPost">
					<div class="bookNews">
						<span class="tips">类别：</span><span><?php echo $sectionName?></span><br>
						
						<span class="tips">书籍名称：</span><span><?php echo $bookName?></span>
						
					</div>
					<?php 
					   
					   if ($reviewId!="")
					       {
					          $showTitle="";
					           $review=getReviewId($reviewId);
					           $title=$review["title"];					           
					           $content=$review["content"];
					           $labelIdBef=$review["labelId"];
					           $showTitle.=<<<html
                              <div class="bookNews">
                                    <input type="hidden" id="title"  value="$title"/>
                                     <input type="hidden" id="detail" name="detail" value="$content"/>
                                    <input type="hidden" id="content" name="content" value="$content" />
                                     <input type="hidden" id="reviewId" name="reviewId" value="$reviewId"/>
                                     <input type="hidden" id="labelBef" name="labelBef" value="$labelIdBef" />
                                       
                                   <span class="tips">标题：</span><span>$title</span><br>
                              </div>
html;
					           
					       }
					       else
					       {
					           $showTitle.=<<<html
					           <div class="title">
                                <input type="hidden" id="detail" name="detail" value=""/>
                                <input type="hidden" id="content" name="content" value="请开始你的吹牛逼" />
					           <input type="text"  name="title" id="title" placeholder="请输入标题(最多50个字)" >
					           </div><!-- /title -->
html;
					       }
					       echo $showTitle;
					?>
					
					<div id="editor" class="postEditor">
						
					</div><!-- postEditor -->
					
					<div class="sort">
						<span class="tips">可为你的书评选择一个标签哦</span>
						<ul class="dowebok">
						<?php 
						$sortLi="";
						$labels=getLabel();
						for ($i=1; $i<count($labels); $i++){
						    $label=$labels[$i]["label"];
						    $labelId=$labels[$i]["labelId"];
						    if($labelIdBef==$labelId)
						    {
						        $sortLi.=<<<html
                                <li><input type="radio" name="label" data-labelauty=$label value="$labelId" checked="checked"></li>
html;
						    }
						    else 
						    {
						        $sortLi.=<<<html
                                <li><input type="radio" name="label" data-labelauty=$label value="$labelId"></li>
html;
						    }
						   
						    
						}
						echo $sortLi;
				        ?>
							
						</ul>
					</div><!-- /sort -->
				</div><!--/mainPost  -->
			
			
			
		
		</div><!-- /main -->
	</form>
<script type="text/javascript" src="../wangEditor-3.1.1/release/wangEditor.min.js"></script>
<script src="../script/postWangEditor.js"></script>
<script src="../script/postExperience.js"></script>
	<div id="previewForm"><!--预览  -->
		<div class="">
			<span class="tips">类别：<?php echo $sectionName; ?></span><br>
			<span class="tips">书籍名称：<?php echo $bookName ;?></span><br>
			<span class="tips">标题：</span><span id="showTitle"></span><br>
			<span class="tips">内容：</span><span id="showContent"></span><br>
			<button onclick="endPreview()">预览结束</button>				
		</div>
	</div>
	</body>
</html>

